_posts/2017-9-14-Function Proxies adds Mock APIs to the Portal.html (30 lines of code) (raw):

--- title: "Function Proxies adds Mock APIs to the Portal" hide_excerpt: true --- <html><head> <meta charset="utf-8"/> </head> <body> <div id="page"> <a class="url fn n profile-usercard-hover" href="https://social.msdn.microsoft.com/profile/Alex Karcher" target="_blank">Alex Karcher</a> <time> 9/14/2017 8:20:46 AM</time> <hr/> <div id="content">I’m very happy to announce mock API and HTTP request/response overrides in the Azure functions portal. This feature allows a function proxy to return sample data through a mock API, enabling development against a functions API endpoint without writing any code. Request/response overrides allows API data to be transformed in flight, enabling new API schemas to be supported without modifying a backend API. This functionality mirrors the existing request/response overrides and mocks <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-proxies#modify-requests-responses">previ</a><a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-proxies#modify-requests-responses">ously only accessible through proxies.json </a> <h2>Examples</h2> The following example shows a mock API that mimics the "hello serverless" example. The example returns a static response while also inserting text from a request parameter. <a href="{{ site.baseurl }}/media/2017/09/Mock-API.png"><img alt="" class="aligncenter size-full wp-image-5796" height="1382" src="{{ site.baseurl }}/media/2017/09/Mock-API.png" width="1808"/></a> The next example performs a transform on requests as they're sent to jsonplaceholder.typicode.com. It changes all HTTP verbs to HTTP GET, and appends the request's verb to the response header. <a href="{{ site.baseurl }}/media/2017/09/Request-Overide2.png"><img alt="" class="aligncenter size-full wp-image-5825" height="1367" src="{{ site.baseurl }}/media/2017/09/Request-Overide2.png" width="1819"/></a> <h2>Learn more</h2> We’ve seen a great response to the proxies preview and we're excited to continue releasing updates <ul> <li>For more product news, follow<span> </span><a href="https://twitter.com/AzureFunctions">@AzureFunctions</a>.</li> <li>To report bugs or file feature requests, please open an issue on the<span> </span><a href="https://github.com/Azure/Azure-Functions">Azure-Functions</a><span> </span>GitHub repo. Please include “Proxies” in the issue title.</li> <li>For technical questions, please post on the<span> </span><a href="https://social.msdn.microsoft.com/Forums/azure/en-US/home?forum=azurefunctions">MSDN forums</a><span> </span>or<span> </span><a href="https://stackoverflow.com/questions/tagged/azure-functions">StackOverflow</a>. The entire Functions engineering team monitors these questions, so you’re sure to get an expert answer.</li> </ul></div> </div></body> <script src="{{ site.baseurl }}/resource/jquery-1.12.1.min.js" type="text/javascript"></script> <script src="{{ site.baseurl }}/resource/replace.js" type="text/javascript"></script> </html>